from rest_framework import serializers

from datasource.models import BucketList
from dvadmin.utils.serializers import CustomModelSerializer
from dvadmin.utils.viewset import CustomModelViewSet


class BucketSerializer(CustomModelSerializer):

    class Meta:
        model = BucketList
        fields = "__all__"

    def create(self, validated_data):
        print(validated_data)
        return super().create(validated_data)
class BucketViewSet(CustomModelViewSet):
    """
    存储桶管理接口
    list:查询
    create:新增
    update:修改
    retrieve:单例
    destroy:删除
    """
    queryset = BucketList.objects.all()
    serializer_class = BucketSerializer
    filter_fields = ['bucketname', ]
    permission_classes = []
